package bdd;

import java.sql.*;

public class DBS {

  private Connection cnx;
  private DB_PROPRIETAIRE db_proprietaire; // sous module specfique de la table proprietaire
  private DB_CLIENT db_client;
  private DB_LOGEMENT db_logement;
  private DB_LOCATION db_location;
  

  public static DBS getInstance(){
	if(null==instance){instance=new DBS();}
	return instance;
  }
  private static DBS instance;
  
  private DBS() {
     try{
        	Class.forName ("org.postgresql.Driver");
		System.out.println("Driver installe");
        	cnx = DriverManager.getConnection ("jdbc:postgresql://localhost/teuteuf", "teuteuf", "kekchoz");
		System.out.println("connexion etablie");
		db_proprietaire = new DB_PROPRIETAIRE(cnx);
		db_client = new DB_CLIENT(cnx);
		db_logement = new DB_LOGEMENT(cnx);
		db_location = new DB_LOCATION(cnx);
     } catch(ClassNotFoundException e){System.out.println(e);}
      catch(SQLException e){System.out.println(e);}
  }

  public DB_PROPRIETAIRE getDB_Proprietaire(){return db_proprietaire;}
  public DB_CLIENT getDB_Client(){return db_client;}
  public DB_LOGEMENT getDB_Logement(){return db_logement;}
  public DB_LOCATION getDB_Location(){return db_location;}
      
}

